<div class="block-news">
<?
//xác định dang mục cha
$parent_id = getRecord('xteam_category', 'code="product"');
$parents = getArray('xteam_category','parent_id='.$parent_id['id']);
$parname = array();
$parid = array();
foreach ($parents as $parent){
    $parname[$parent['id']] = $parent['name'];
    $parid[$parent['id']] = $parent['id'];
}
//bắt dữ liệu từ search
$arry_get=$_REQUEST;

$end_get = count($arry_get)-5;
$newarray = array();
for($i=0; $i<=$end_get;$i++){
    if($i>=1) array_push($newarray,key($arry_get));
    next($arry_get);
}
//echo "<pre>"; print_r ($newarray); echo "</pre>";
//lấy id của các thuộc tính search
if($newarray){
    foreach ($newarray as $item){
        if($_REQUEST[$item])
            $list_id .= killInjection ($_REQUEST[$item]).',';
    }
}
$num_port = count(explode(',', substr($list_id,0,-1)));
$list_id = substr($list_id,0,-1);
if($list_id!=''){
    //điều kiện lọc các thuộc tính search
    $where_in = ' properties_id IN ('.$list_id.')';
    $listid_pro = mysql_query("SELECT product_id, count(product_id) count FROM `xteam_product_extend` WHERE ".$where_in." GROUP BY product_id");
    while($row=mysql_fetch_assoc($listid_pro)){
        if($row['count']>=$num_port) $list_id_product .= $row['product_id'].',';
    }
    $where_product = substr($list_id_product, 0,-1);
    $result = mysql_query("SELECT * FROM xteam_product WHERE id IN (".$where_product.")");
    if($result){
    $num=0;
    while($row=mysql_fetch_assoc($result)){
        $properties = product_properties($row['id']);
        $num++;
        $class = $num%2!=0? "block-left":"block-right";
        if($parid[$top_pro[$i]['parent_id']]%2==0){$class_sp="rental";}else{$class_sp="salse";}?>
            <div class="<?=$class?>">
                <h2 class="title-news">
                    <a href="<?=$curHost.$parid[$row['parent_id']]?>-<?=str_replace(array('--','--'), '-', utf8_to_ascii($parid[$row['seo_key']]))?>/7-<?=str_replace(array('--','--'), '-', utf8_to_ascii($parname[$row['parent_id']]))?>.html">
                        <span class="<?=$class_sp?>"><?=$parname[$row['parent_id']]?> | </span>
                    </a>
                    <a href="<?=$curHost.$row['id'].'-'.str_replace(array('--','--'), '-', utf8_to_ascii($row['seo_key']))?>/1-<?=str_replace(array('--','--'), '-', utf8_to_ascii($row['name']))?>.html" title="<?=$row['name']?>" >
                        <?=catchu($row['name'],30)?>
                    </a>
                </h2>
                <a href="<?=$curHost.$row['id'].'-'.str_replace(array('--','--'), '-', utf8_to_ascii($row['seo_key']))?>/1-<?=str_replace(array('--','--'), '-', utf8_to_ascii($row['name']))?>.html" title="<?=$row['name']?>" >
                    <? if($row['image_thumbs']){?>
                    <img class="img-news" src="<?=$curHost?><?=$row['image_thumbs']?>" title="<?=$row['name']?>" alt="<?=$row['name']?>" />
                    <? }else{?>
                    <img src="<?=$curHost?>images/no_image.gif" alt="<?=$row['seo_key']." - ".$row["name"]?>"  class="img-news" style="display: inline;" title="<?=$row['name']?>" />
                    <? }?>
                </a>
                <div class="short-news">
                    <ul>
                    <?
                    if($properties){
                        foreach($properties as $prop){?>
                        <li><label><?=$prop['cat']?>:&nbsp;</label><span><?=$prop['name']?></span></li>
                    <?
                        }
                    }else{?>
                        <li><label>đang cập nhật</label></li>
                    <? }?>
                    </ul>
                </div>
            </div>
        <? if($num%2==0){echo '<div class="clear"></div></div><div class="block-news">'; }?>
    <? }
    }
}?>
        </div>
<div class="cleared"></div>
<script language="javascript" type="text/javascript">
	$(document).ready(function(){
		var contentdiv = $('.block-news').text(function(){
			if ($.trim($(this).text())==''){
				$(this).hide();
			}
			});

	})
</script>